﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="ModuleEdit.aspx.cs" Inherits="news_ModuleEdit" %>

<%@ Register src="ModuleCell.ascx" tagname="ModuleCell" tagprefix="uc1" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <script src="../js/jquery-1.3.2.min.js" type="text/javascript" language="javascript"></script>
    <script src="../js/jquery-ui-1.7.3.custom.min.js" language="javascript" type="text/javascript"></script>
    <link href="../css/jquery-ui-1.7.3.custom.css" rel="Stylesheet" type="text/css" />
    <script type="text/javascript" language="javascript">
        $(document).ready(function () {
            $('#dialog').dialog({
                autoOpen: false,
                modal: false,
                width: 300,
                buttons: {
                    "取消": function () {
                        $(this).dialog("close");

                    },
                    "确定": function () {
                        var id = $("#hidTempTitleId").val();
                        var hids = $("#" + id).parent().children("input[type=hidden]");
                        if (hids[0].id.indexOf("hidBold") > -1) {
                            hids[0].value = $("#drpBold").val();
                            hids[1].value = $("#txtColor").val();
                        }
                        else {
                            hids[1].value = $("#drpBold").val();
                            hids[0].value = $("#txtColor").val();
                        }
                        $("#" + id).parent().children("input[type=text]").css("color", $("#txtColor").val()).css("font-weight", $("#drpBold").val());



                        $(this).dialog("close");
                    }
                }
            });

            $("[title=true]").dblclick(function () {
                $("#hidTempTitleId").val(this.id);
                $('#dialog').dialog("open");
            })

            $.post("GetColor.ashx", {}, function (data) {
                data = eval("(" + data + ")")
                var html = "";
                for (var i = 0; i < data.length; i++) {
                    html += "<tr>"
                    var c = data[i];
                    for (var j = 0; j < c.length; j++) {
                        html += "<td iscolor='true' color='" + c[j] + "' style=\"background-color:" + c[j] + "\">&nbsp;</td>"
                    }
                    html += "</tr>";
                }
                $("#tbColor").html(html);
                $("#[iscolor=true]").click(function () {
                    $("#aa").hide();
                    var color = $(this).attr("color");
                    $("#txtColor").val(color);
                    $("#txtColor").css("color", color);
                })

                $("#[iscolor=true]").mouseover(function () {
                    var color = $(this).attr("color");
                    $("#txtColor").val(color);
                    $("#txtColor").css("color", color);

                })
            })

            $("#txtColor").change(function () {
                $("#txtColor").css("color", $(this).val());
            })

            $("#txtColor").click(function () {
                $("#aa").css("left", $(this).offset().left);
                $("#aa").css("top", $(this).offset().top + 28);
                $("#aa").show(500);
            })

            $("#dialog").bind("dialogclose", function (event, ui) {
                $("#txtColor").css("background-color", "#FFFFFF");
                $("#txtColor").val('');
                $("#drpBold").val("0");
                $("#hidTempTitleId").val('');
                $("#aa").hide();
            });
            $("[isGenduo=1]").click(function () {

                var hangshu = $(this).attr("hangshu");
                var trs = $("[name=trHangshu" + hangshu+"]");
                for (var i = 0; i < trs.length; i++) {
                    if ($(trs[i]).css("display") == 'none') {
                        $(trs[i]).css("display", "");
                    }
                    else {
                        $(trs[i]).css("display", "none");
                    }
                }
                return false;
            })

        })
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:Label ID="lblPageName" runat="server" />>><asp:Label ID="lblModuleName" runat="server" /><br />
        <asp:Button ID="btnImport" runat="server" Text="加载记录" 
            onclick="btnImport_Click" /><asp:Button ID="btnSave" runat="server" 
            Text="保存记录" onclick="btnSave_Click" />
        <asp:Button ID="btnImportTemp" runat="server" Text="加载草稿" 
            onclick="btnImportTemp_Click" />
        <asp:Button ID="btnSaveTemp" runat="server" Text="保存草稿" 
            onclick="btnSaveTemp_Click" />
        <asp:Button ID="btnClear" runat="server" Text="清空" onclick="btnClear_Click" />
    </div>
    <div>
        <asp:DataList ID="DataList1" runat="server">
            <ItemTemplate>
                <uc1:ModuleCell ID="ModuleCell1" runat="server" ModuleId='<%#Eval("ModuleId") %>' Hangshu='<%# Eval("Hangshu") %>' />
            </ItemTemplate>
        </asp:DataList>
    </div>
    <div id="dialog" title="选择标题样式" >
        <p id="content" style="text-align: left">
            是否加粗
            <select id="drpBold" >
                <option value="normal" selected="selected">否</option>
                <option value="bold" >是</option>
            </select>
                        
        </p>
        <p style="text-align: left">
            颜色
            <input id="txtColor" type="text"  style="width:100px"  /><input type="button" value="清空" onclick="document.getElementById('txtColor').value='';document.getElementById('aa').style.display='none'" />
            <input type="button" value="隐藏" onclick="document.getElementById('aa').style.display='none'" />
        </p>
        
    </div>
    <div style="display:none;position:absolute; z-index:10000" id="aa">
        <table width="160px" id="tbColor" style="font-size:10px;border-collapse:collapse" border="1">
            
        </table>
    </div>
    </form>
    <input id="hidTempTitleId" type="hidden" />
 
</body>
</html>
